<template>
  <div id="app">
    <router-view/>
    <van-tabbar v-model="active" class="footbar" v-if="isShowFoot">
      <van-tabbar-item icon="yemian-copy" :to="{name: 'Home'}" >首页</van-tabbar-item>
      <van-tabbar-item icon="wode" :to="{name: 'UserIndex'}">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import { Tabbar, TabbarItem } from 'vant'
import {mapState} from 'vuex'
export default {
  name: 'app',
  components: {
    [Tabbar.name]: Tabbar,
    [TabbarItem.name]: TabbarItem,
  },
  computed: {
      ...mapState({
        isShowFoot:state => state.user.isShowFoot,
        // direction:state => state.user.direction,
        route: state => state.route,
        path: state => state.route.path,
      }),
      active:{
        get:function() {
          // console.log('[active]',this.route)
          if(this.route.path == ('/')) return 0
      else if(this.route.path == ('/user_index')) return 1
      },
    set:function() {}
    }
  },
  data() {
    return {
      // active: 0 
    } 
  },
}
</script>

<style lang="scss">
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
#nav {
  padding: 30px;
  a {
    font-weight: bold;
    color: #2c3e50;
    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
